﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;

namespace MulticastTV
{
    public partial class Report : Form
    {
        public Report()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            Interfaces nif = new Interfaces();
            OperatingSystem os = Environment.OSVersion;
            Version vs = os.Version;
            string osys = "Unknown";
            if (os.Platform == PlatformID.Win32NT && vs.Major == 6 && vs.Minor == 1)
                osys = "Windows 7";
            else if (os.Platform == PlatformID.Win32NT && vs.Major == 6 && vs.Minor == 0)
                osys = "Windows Vista";
            else if (os.Platform == PlatformID.Win32NT && vs.Major == 5 && vs.Minor == 1)
                osys = "Windows Xp";
            else if (os.Platform == PlatformID.Win32NT && vs.Major == 5 && vs.Minor == 2)
                osys = "Windows Xp Professional x64";

            string bit64 = "No";
            if (StandBy.Is64bitOS)
                bit64 = "True";

            //plugin
            string plugName = "None";
            Types.AvailablePlugin selectedPlugin = GlobalP.Plugins.AvailablePlugins.Find(Properties.Settings.Default.EPGPlugin);
            if (selectedPlugin != null)
            {
                plugName = selectedPlugin.Instance.Name + " " + selectedPlugin.Instance.Version;
            }

            string[] rep = new string[10];

            string selectInterfaceBy = "Auto";
            if (Properties.Settings.Default.VistaHack == 1)
                selectInterfaceBy = "Ip";
            else if (Properties.Settings.Default.VistaHack == 2)
                selectInterfaceBy = "Index";

            string recFormat = "";
            if (Properties.Settings.Default.RecRaw)
                recFormat = "Raw";
            else
                recFormat = Properties.Settings.Default.RecordingFormat;


            rep[0] = "Ver:  "+Assembly.GetExecutingAssembly().GetName().Version.ToString();
            rep[1] = "Network:  " + nif.networkInterfaceSummary();
            rep[2] = "Selected NIC:  supports multicast: " + nif.supportsMulticast(int.Parse(Globals.interfaceindex)).ToString() + ", identified by: " +selectInterfaceBy;
            rep[3] = "OS:  " + osys;
            rep[4] = "64 bit:  " + bit64;
            rep[5] = "Video output:  " + Properties.Settings.Default.VideoOutV3;
            rep[6] = "Video deinterlacing:  "+Properties.Settings.Default.VideoDeinterlaceV4+", enabled: "+Properties.Settings.Default.VideoDeinterlaceEnabled.ToString();
            rep[7] = "H264 skip loop filter: " + Properties.Settings.Default.VideoSkipLoopFilterV2.ToString();
            rep[8] = "Epg plugin:  " + plugName;
            rep[9] = "'Record now' format:  " + recFormat + ", timer recording format: Raw (default)";

            foreach (string r in rep)
            {
                richTextBox1.AppendText(r + "\n");
            }
        }
    }
}
